home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Suzy B Software 2
/
Suzy B Software CD-ROM 2 (1994).iso
/
bootup
/
boot_n2z
/
timedatl
/
timedate.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-02
|
2KB
|
68 lines
#include <stdio.h>
#include <osbind.h>
/* ╜ Lena 1990/12/01 */
dateinfo mydate;
timeinfo mytime;
datetime mydatetime;
char t[6];
main ()
{
mydatetime.realtime = Gettime (); /* Work with time from KEYBOARD */
if (mydatetime.part.year < 10 || mydatetime.part.year > 47) {
t[0]='n';
while (t[0]=='n' || t[0]=='N') {
changetime ();
printf (" \nCorrect? ");
gets (t);
}
}
mytime.part.seconds = mydatetime.part.seconds; /* Set time in GEMDOS */
mytime.part.minutes = mydatetime.part.minutes; /* from KEYBOARD clock*/
mytime.part.hours = mydatetime.part.hours; /* to insure that */
mydate.part.day = mydatetime.part.day; /* time is correct */
mydate.part.month = mydatetime.part.month;
mydate.part.year = mydatetime.part.year;
Tsettime (mytime.realtime);
Tsetdate (mydate.realdate);
}
showtime ()
{
printf ("\n\t Date: %d/%d/%d\n",
mydatetime.part.year + 80,
mydatetime.part.month,
mydatetime.part.day
);
printf ("\t Time: %d:%d:%d\n",
mydatetime.part.hours,
mydatetime.part.minutes,
mydatetime.part.seconds
);
}
changetime ()
{
printf ("\n Set Time & Date\n");
printf ("╜ Lena 1990/12/01\n");
showtime ();
printf ("\n (yymmdd) Date: ");
gets (t);
if (t[0] != 0) {
mydatetime.part.day = t[5]-'0' + (t[4]-'0')*10;
mydatetime.part.month = t[3]-'0' + (t[2]-'0')*10;
mydatetime.part.year = t[1]-'0' + ((t[0]-'0')*10)-80;
}
printf (" (hhmmss) Time: ");
gets (t);
if (t[0] != 0) {
mydatetime.part.seconds = (t[5]-'0'+ (t[4]-'0')*10)/2;
mydatetime.part.minutes = t[3]-'0' + (t[2]-'0')*10;
mydatetime.part.hours = t[1]-'0' + (t[0]-'0')*10;
}
Settime (mydatetime.realtime);
showtime ();
}